<#list pks as prop>
var ${prop.alias} = T.p("${prop.alias}");

var vm = new Vue({
	el:'#rrapp',
	data:{
		title:"新增",
		${config.objectName?uncap_first}:{}
	},
	created: function() {
		if(${prop.alias} != null){
			this.title = "修改";
			this.getInfo(${prop.alias})
		}
    },
	methods: {
		getInfo: function(${prop.alias}){
			$.get("../${config.objectName?uncap_first}/info/"+${prop.alias}, function(outJson){
                vm.${config.objectName?uncap_first} = outJson.${config.objectName?uncap_first};
            });
		},
		saveOrUpdate: function (event) {
			var url = vm.${config.objectName?uncap_first}.${prop.alias} == null ? "../${config.objectName?uncap_first}/save" : "../${config.objectName?uncap_first}/update";
			$.ajax({
				type: "POST",
			    url: url,
			    data: JSON.stringify(vm.${config.objectName?uncap_first}),
			    success: function(outJson){
			    	if(outJson.code === 0){
						alert('操作成功', function(index){
							vm.back();
						});
					}else{
						alert(outJson.msg);
					}
				}
			});
		},
		back: function (event) {
			history.go(-1);
		}
	}
});
</#list>